from common.httpRequest import Webrequests


# 商家web端登录
class yyLogin:
    def __init__(self, name, password, appKey='QTSHE_WEB', orgId='1'):
        self.name = name
        self.password = password
        self.appKey = appKey
        self.orgId = orgId


#appKey=OPT_WEB&orgId=1&name=SUPER_ADMIN&password=111111Aa
    def do_yyLogin(self):
        url = "http://test-api.yy.qtshe.com/mate/login"
        headers = {'Content-Type': 'application/x-www-form-urlencoded'}
        param = {'appKey': str(self.appKey), 'orgId': str(self.orgId), 'name': str(self.name), 'password': str(self.password)}
        try:
           r = Webrequests(url, param, headers).post()
           if r.status_code == 200:
               print("登录成功")
               print("登录参数:"+str(param))
               return r
        except Exception as e:
            print("登录失败")




